<div id="content">
  <div class="row s_page_title">
    <sa-big-breadcrumbs
      [items]="['物料跟踪管理', '基础信息维护', '物料管理（全）']"
      icon="fa-lg fa-fw fa fa-cubes"
      class="col-xs-12 col-sm-7 col-md-7 col-lg-4"
    ></sa-big-breadcrumbs>
  </div>
  <sa-widgets-grid>
    <div class="s_table">
      <div sa-widget [editbutton]="false" color="darken" class="clearfix">
        <header>
          <span class="widget-icon"><i class="fa fa-table"></i></span>
          <h2>物料管理（全）</h2>
        </header>
        <div>
          <div class="widget-body no-padding">
            <div class="page-header clearfix s_table_opreation">
              <div class="left page-header-btn">
                <div class="top_module top_module_box">
                  <span class="top_module_label module_text">物料类型</span>
                  <select name="" class="top_module_select" [(ngModel)]="materielType">
                    <option value="">全部</option>
                    <option *ngFor="let item of materialTypeList" [value]="item.materielType">
                      {{ item.materielTypeName }}
                    </option>
                  </select>
                </div>
                <div class="top_module cancle">
                  <span class="module_text">物料名称</span>
                  <input
                    type="text"
                    class="module_inp top_module_select ng-pristine ng-valid ng-touched"
                    placeholder="物料名称"
                    [(ngModel)]="materielName"
                  />
                  <div class="s_del_icon" (click)="delKey('materielName')">x</div>
                </div>
                <div class="top_module cancle">
                  <span class="module_text">物料编码</span>
                  <input
                    type="text"
                    class="module_inp top_module_select ng-pristine ng-valid ng-touched"
                    placeholder="物料编码"
                    [(ngModel)]="materielNumber"
                  />
                  <div class="s_del_icon" (click)="delKey('materielNumber')">x</div>
                </div>
                <div class="top_module cancle">
                  <span class="module_text">规格型号</span>
                  <input
                    type="text"
                    class="module_inp top_module_select ng-pristine ng-valid ng-touched"
                    placeholder="规格型号"
                    [(ngModel)]="specifications"
                  />
                  <div class="s_del_icon" (click)="delKey('specifications')">x</div>
                </div>

                <button type="button" class="btn btn-primary" (click)="tableSearch()">查询</button>
              </div>
            </div>
            <div class="table_scroll">
              <table
                class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table"
              >
                <thead>
                  <tr>
                    <th>物料类型</th>
                    <th>物料编码</th>
                    <th>物料名称</th>
                    <th>物料别名</th>
                    <th>规格型号</th>
                    <th>通道</th>
                    <th>版本号</th>
                    <th>贴片卡</th>
                    <th>单位</th>

                    <th>创建人</th>
                    <th>创建时间</th>
                    <th>编辑人</th>
                    <th>编辑时间</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                  <tr *ngFor="let row of tableData">
                    <td>{{ row.materielTypeStr }}</td>
                    <td>{{ row.materielNumber }}</td>
                    <td>{{ row.materielName }}</td>
                    <td>{{ row.materielAlias }}</td>
                    <td>{{ row.specifications }}</td>
                    <td>{{ row.sensorChannel }}</td>
                    <td>{{ row.version }}</td>
                    <td>{{ row.sim }}</td>
                    <td style="text-align: center">{{ row.unit }}</td>
                    <td>{{ row.createUser }}</td>
                    <td>{{ row.createTime }}</td>
                    <td>{{ row.updateUser }}</td>
                    <td>{{ row.updateTime }}</td>
                    <td>
                      <button type="button" (click)="updata_domCode(row, addBomCodeModal)">编辑</button>
                      <button type="button" (click)="del_domCode(row)">删除</button>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="table-fix clearfix">
              <paginator
                [totalRecords]="totalCounts"
                [rows]="pageSize"
                [currentPage]="curPage - 1"
                (onPageChange)="paginate($event)"
              ></paginator>
              <button type="button" class="btn default refresh_btn" (click)="refresh()">
                <i class="fa fa-refresh"></i>
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </sa-widgets-grid>
</div>
<!-- 添加编辑物料编码 -->
<section
  bsModal
  #addBomCodeModal="bs-modal"
  id="addBomCodeModal"
  class="modal fade"
  tabindex="-1"
  role="dialog"
  aria-labelledby="myLargeModalLabel"
  aria-hidden="true"
>
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" (click)="closeAddBomModal(addBomCodeModal)" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title">编辑物料信息</h4>
      </div>
      <div class="modal-body">
        <form
          id="bomHoldFrom"
          class="form-horizontal"
          role="form"
          novalidate="novalidate"
          [saBootstrapValidator]="validatorOptions"
        >
          <div class="row form-horizontal">
            <div class="form-group clearfix">
              <label class="control-label col-sm-2 no-padding-right">
                物料类型
                <sup>*</sup>
              </label>
              <div class="col-sm-9">
                <select
                  class="form-control"
                  name="type"
                  [(ngModel)]="material.materielType"
                  (change)="typeChange($event.target.value)"
                  style="width: 100%"
                >
                  <option *ngFor="let item of materialTypeList" [value]="item.materielType">
                    {{ item.materielTypeName }}
                  </option>
                </select>
              </div>
            </div>

            <div class="form-group clearfix">
              <label class="control-label col-sm-2 no-padding-right">
                物料编码
                <sup>*</sup>
              </label>
              <div class="col-sm-9">
                <div class="clearfix">
                  <input
                    class="form-control"
                    name="materialCode"
                    [(ngModel)]="material.materielNumber"
                    disabled
                    type="text"
                    placeholder="请填写物料编码"
                  />
                </div>
              </div>
            </div>

            <div class="form-group clearfix">
              <label class="control-label col-sm-2 no-padding-right">
                物料名称
                <sup>*</sup>
              </label>
              <div class="col-sm-9">
                <div class="clearfix">
                  <input
                    class="form-control"
                    name="materielName"
                    [(ngModel)]="material.materielName"
                    type="text"
                    placeholder="请填写物料名称"
                  />
                </div>
              </div>
            </div>

            <div class="form-group clearfix">
              <label class="control-label col-sm-2 no-padding-right">物料别名</label>
              <div class="col-sm-9">
                <div class="clearfix">
                  <input
                    class="form-control"
                    name="materielAlias"
                    [(ngModel)]="material.materielAlias"
                    type="text"
                    placeholder="请填写物料别名"
                  />
                </div>
              </div>
            </div>

            <div class="form-group clearfix">
              <label class="control-label col-sm-2 no-padding-right">
                规格型号
                <sup>*</sup>
              </label>
              <div class="col-sm-9">
                <div class="clearfix">
                  <input
                    class="form-control"
                    name="specifications"
                    [(ngModel)]="material.specifications"
                    type="text"
                    placeholder="请填写规格型号"
                  />
                </div>
              </div>
            </div>

            <div [ngStyle]="{ display: material.materielType === '1' ? 'block' : 'none' }">
              <div class="form-group clearfix">
                <label class="control-label col-sm-2 no-padding-right">
                  通道
                  <sup>*</sup>
                </label>
                <div class="col-sm-9">
                  <div class="clearfix">
                    <input
                      class="form-control"
                      name="sensorChannel"
                      [(ngModel)]="material.sensorChannel"
                      type="text"
                      [disabled]="material.materielType !== '1' ? true : false"
                      placeholder="请填写通道"
                    />
                  </div>
                </div>
              </div>

              <div class="form-group clearfix">
                <label class="control-label col-sm-2 no-padding-right">
                  版本号
                  <sup>*</sup>
                </label>
                <div class="col-sm-9">
                  <div class="clearfix">
                    <input
                      class="form-control"
                      name="version"
                      [(ngModel)]="material.version"
                      type="text"
                      [disabled]="material.materielType !== '1' ? true : false"
                      placeholder="请填写版本号"
                    />
                  </div>
                </div>
              </div>

              <div class="form-group clearfix">
                <label class="control-label col-sm-2 no-padding-right">
                  贴片卡
                  <sup>*</sup>
                </label>
                <div class="col-sm-9">
                  <div class="clearfix">
                    <input
                      class="form-control"
                      name="sim"
                      [(ngModel)]="material.sim"
                      type="text"
                      [disabled]="material.materielType !== '1' ? true : false"
                      placeholder="请填写贴片卡"
                    />
                  </div>
                </div>
              </div>
            </div>

            <div class="form-group clearfix">
              <label class="control-label col-sm-2 no-padding-right">
                单位
                <sup>*</sup>
              </label>
              <div class="col-sm-9">
                <div class="clearfix">
                  <input
                    class="form-control"
                    name="unit"
                    [(ngModel)]="material.unit"
                    type="text"
                    placeholder="请填写单位"
                  />
                </div>
              </div>
            </div>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" (click)="closeAddBomModal(addBomCodeModal)">取消</button>
        <button type="button" class="btn btn-primary" (click)="submitModal(addBomCodeModal)">提交</button>
      </div>
    </div>
  </div>
</section>
<!-- 添加BOM编码  结束 -->
